Skip to content

Guard against non-dict Payload in is_step_function_event - #846

Merged
purple4reina merged 1 commit into
mainfrom
rey.abolofia/payload-string
Jul 29, 2026
Merged

Guard against non-dict Payload in is_step_function_event#846
purple4reina merged 1 commit into
mainfrom
rey.abolofia/payload-string

Conversation

@purple4reina

@purple4reina purple4reina commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Fixes #845

Summary

  • is_step_function_event unwrapped event.get(\"Payload\", event) and then checked for dict keys without verifying the unwrapped value was actually a dict, which broke when Payload was a string.
  • Add an isinstance(event, dict) guard that returns False early when the payload isn't a dict.

Test plan

  • Added test_is_step_function_event_payload_not_dict in tests/test_trigger.py
  • python -m pytest tests/test_trigger.py -k IsStepFunctionEvent passes

@purple4reina
purple4reina requested review from a team as code owners July 28, 2026 23:59
@purple4reina
purple4reina requested a review from lym953 July 28, 2026 23:59
@datadog-datadog-prod-us1

This comment has been minimized.

Some Step Functions integrations pass a string Payload, which previously
caused incorrect behavior when checking for step function event fields.
@purple4reina
purple4reina force-pushed the rey.abolofia/payload-string branch from ab61bb2 to e98bcb1 Compare July 29, 2026 00:01
@purple4reina
purple4reina merged commit 3eb3590 into main Jul 29, 2026
104 checks passed
@purple4reina
purple4reina deleted the rey.abolofia/payload-string branch July 29, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

is_step_function_event crashes with AttributeError when event["Payload"] is a string

2 participants